<template>
  <div>
    <van-field
      v-model="text"
      :label="props.isSearch ? '' : '文本'"
      placeholder="请输入用户名"
    />
  </div>
</template>

<script setup>
import { ref, defineOptions, defineProps } from "vue";

defineOptions({
  name: "mdInput",
});

const props = defineProps({
  // 是否在搜索容器
  isSearch: {
    type: Boolean,
    default: false,
  },
  item: {
    type: Object,
    default: () => {},
  },
});

const text = ref("");

// 向外暴露值
const getValue = () => {
  return {
    item: props.item,
    value: text.value,
  };
};

defineExpose({
  getValue,
});
</script>

<style lang="scss" scoped></style>
